///////////////////////////////////////////////////////////////////////////////
// Company: University of Cincinnati
// Author: Jordan Ross, Ben Gentry, Bryan Butsch
//
// Created Date: 09/22/2013
// Design Name:
// Module Name: counter
// Project Name: top_level
// Target Devices: Cyclone II EP2C20F484C7
// Tool Versions: Quartus 13.0
// Description: This module is a simple counter that counts from n=0 to n=SIZE,
//   where SIZE is the number of valid memory addresses present in memory.
// 
// Dependencies: None.
// 
// Revision:
// 0.01 - File Created
//
// Additional Comments:
//
///////////////////////////////////////////////////////////////////////////////
module counter(MClock, Resetn, n);
    
    /* Paramters */
    parameter SIZE=5;        // 2^5 = 32 instructions
  
    /* Inputs */
    input MClock;  // Memory Clock
    input Resetn;            // Reset instruction coutner
    
    /* Outputs */
    output reg [SIZE-1:0]n;  // Instruction counter
    
    /* Initialize */
    initial n=0;
    
    /* Increment count on clock */
    always @(posedge MClock) begin
        if (Resetn)
            n = n + 1;
        else
            n = 0;
    end
    
endmodule
